package com.xnsy.jishexiangmu.mapper;

import com.xnsy.jishexiangmu.pojo.Article;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ArticleMapper {
    // 获取当前用户文章
    @Select("select * from wenzhang where username = #{username}")
    List<Article> get(String username);
    @Insert("insert into wenzhang(username,name,to_where,contain,kepu,article_static,create_time)" +
            "values(#{username},#{name},#{toWhere},#{contain},#{kepu},#{articleStatic},now())")
    void add(Article article);
    @Delete("delete from wenzhang where aid = #{aid} and username = #{username}")
    void deleteArticle(int aid, String username);
    @Update("update wenzhang set article_static = 1 where aid = #{aid} and username = #{username}")
    void fabu(Integer aid, String username);
    @Update("update wenzhang set article_static = 0,name = #{name},contain = #{contain},kepu = #{kepu}" +
            "where username = #{username} and aid = #{aid}")
    void updataArticle(Article article);
    @Select("select * from wenzhang")
    List<Article> getAll();
    @Select("select * from wenzhang where aid = #{id}")
    Article getarticle(Integer id);
}
